<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>原生dom操作</title>
  </head>
  <body>
    <h3 id="h3Title"></h3>
    <!-- 视图是可以更新数据的，但数据不能更新视图 -->
    <input type="text" id="inputTitle" />

    <script>
      // 获取dom对象
      const h3Title = document.getElementById('h3Title')
      const inputTitle = document.getElementById('inputTitle')

      // 获取事件
      inputTitle.addEventListener('input', function () {
        data.title = this.value
      })

      // 声明数据
      let data = {
        title: '你好dom'
      }
      h3Title.innerHTML = data.title
      inputTitle.value = data.title
    </script>
  </body>
</html>
